const path = require('path')
const { name } = require('./package');

module.exports = {
  webpack: {
    alias: {
      '@': path.resolve(__dirname, 'src')
    },
    configure(config) {
      config.output.library = `${name}-[name]`;
      config.output.libraryTarget = 'umd';
      // webpack 5 需要把 jsonpFunction 替换成 chunkLoadingGlobal
      config.output.chunkLoadingGlobal = `chunkLoadingGlobal_${name}`; 
      config.output.globalObject = 'window';
      config.output.publicPath = 'http://localhost:3030/'
  
      return config;
    }
  },
  devServer(config) {
    config.historyApiFallback = true;
    return config
  }
}